package com.ssy.lingxi.member.merchant.repository;

import com.ssy.lingxi.member.merchant.entity.MemberDO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 会员注册信息Repository
 * @author 万宁
 * @version 2.0.0
 * @date 2020-06-03
 */
@Repository
public interface MemberRepository extends JpaRepository<MemberDO,Long>, JpaSpecificationExecutor<MemberDO> {
    boolean existsByName(String name);

    boolean existsByNameAndIdNot(String name, Long id);

    MemberDO findFirstByAccount(String account);

    List<MemberDO> findByNameContainsAndIdIn(String name, List<Long> memberIds);

    Page<MemberDO> findAllByNameLike(String name, Pageable pageable);
}
